<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Easy
  </div>
  <div>
   <h1 class="question_title">
    799. Minimum Distance Between BST Nodes
   </h1>
   <p>
    Given a Binary Search Tree (BST) with the root node
    <code>
     root
    </code>
    , return&nbsp;the minimum difference between the values of any two different nodes in the tree.
   </p>
   <p>
    <strong>
     Example :
    </strong>
   </p>
   <pre>
<strong>Input:</strong> root = [4,2,6,1,3,null,null]
<strong>Output:</strong> 1
<strong>Explanation:</strong>
Note that root is a TreeNode object, not an array.

The given tree [4,2,6,1,3,null,null] is represented by the following diagram:

          4
        /   \
      2      6
     / \    
    1   3  

while the minimum difference in this tree is 1, it occurs between node 1 and node 2, also between node 3 and node 2.
</pre>
   <p>
    <strong>
     Note:
    </strong>
   </p>
   <ol>
    <li>
     The size of the BST will be between 2 and&nbsp;
     <code>
      100
     </code>
     .
    </li>
    <li>
     The BST is always valid, each node's value is an integer, and each node's value is different.
    </li>
   </ol>
  </div>
  <div>
   <h1 class="question_title">
    799. 二叉搜索树结点最小距离
   </h1>
   <p>
    给定一个二叉搜索树的根结点&nbsp;
    <code>
     root
    </code>
    , 返回树中任意两节点的差的最小值。
   </p>
   <p>
    <strong>
     示例：
    </strong>
   </p>
   <pre>
<strong>输入:</strong> root = [4,2,6,1,3,null,null]
<strong>输出:</strong> 1
<strong>解释:</strong>
注意，root是树结点对象(TreeNode object)，而不是数组。

给定的树 [4,2,6,1,3,null,null] 可表示为下图:

          4
        /   \
      2      6
     / \    
    1   3  

最小的差值是 1, 它是节点1和节点2的差值, 也是节点3和节点2的差值。</pre>
   <p>
    <strong>
     注意：
    </strong>
   </p>
   <ol>
    <li>
     二叉树的大小范围在
     <code>
      2
     </code>
     到&nbsp;
     <code>
      100
     </code>
     。
    </li>
    <li>
     二叉树总是有效的，每个节点的值都是整数，且不重复。
    </li>
   </ol>
  </div>
 </body>
</html>